<template>
  <div>
    <el-dialog title="进程更新" :visible.sync="dialogVisible">
      <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="100px" class="demo-ruleForm">
        <el-form-item label="招聘单号" prop="name">
          <el-input v-model="ruleForm.order_num" disabled />
        </el-form-item>
        <el-form-item label="招聘进程" prop="name">
          <el-input v-model="ruleForm.msg" type="textarea" />
        </el-form-item>
        <el-form-item>
          <el-button @click="dialogVisible = false">取 消</el-button>
          <el-button type="primary" @click="submitForm('ruleForm')">提交</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
  </div>
</template>

<script>
import { uploadRecruitProcessApi } from '@/api/main'
export default {
  data() {
    return {
      dialogVisible: false,
      ruleForm: {
        order_num: '',
        msg: ''
      },
      rules: {
        order_num: [
          { required: true, message: '请输入订单编号', trigger: 'blur' }
        ],
        msg: [
          { required: true, message: '请输入进程内容', trigger: 'blur' }
        ]
      }
    }
  },
  methods: {
    submitForm(formname) {
      this.$refs[formname].validate((valid) => {
        if (valid) {
          this.uploadProcessFun()
        }
      })
    },
    uploadProcessFun() {
      const data = this.ruleForm
      uploadRecruitProcessApi(data).then(res => {
        if (res.code === 200) {
          this.$message.success(res.msg)
          this.dialogVisible = false
          this.$emit('reloadFun')
        }
      })
    }
  }
}
</script>

<style lang="sass" scoped>

</style>
